home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Visual Basic Source Code
/
Visual Basic Source Code.iso
/
vbsource
/
kidplay
/
playwav.frm
< prev
next >
Wrap
Text File
|
1995-05-08
|
4KB
|
141 lines
VERSION 2.00
Begin Form Form1
Caption = "PLAYWAV"
ClientHeight = 4530
ClientLeft = 1065
ClientTop = 1350
ClientWidth = 11670
FontBold = -1 'True
FontItalic = 0 'False
FontName = "MS Sans Serif"
FontSize = 29.25
FontStrikethru = 0 'False
FontUnderline = 0 'False
Height = 4935
Left = 1005
LinkMode = 1 'Source
LinkTopic = "Form1"
ScaleHeight = 4530
ScaleWidth = 11670
Top = 1005
Width = 11790
Begin TextBox Name2
FontBold = -1 'True
FontItalic = 0 'False
FontName = "MS Sans Serif"
FontSize = 29.25
FontStrikethru = 0 'False
FontUnderline = 0 'False
Height = 840
Left = 4080
TabIndex = 2
Top = 3720
Width = 7575
End
Begin TextBox Name1
FontBold = -1 'True
FontItalic = 0 'False
FontName = "MS Sans Serif"
FontSize = 29.25
FontStrikethru = 0 'False
FontUnderline = 0 'False
Height = 840
Left = 0
TabIndex = 1
Top = 3720
Width = 4095
End
Begin PictureBox Picture1
Height = 615
Index = 0
Left = 0
ScaleHeight = 585
ScaleWidth = 585
TabIndex = 0
Top = 0
Width = 615
End
End
Dim a$(114)
Dim b$(500)
Dim ActualIcons As Integer
Sub Form_Load ()
vsize = Picture1(0).Height
hsize = Picture1(0).Width
Picture1(0).BackColor = RGB(Rnd(1) * 256, Rnd(1) * 256, Rnd(1) * 256)
For i = 1 To 113
ih = Int(i / 19)
il = i - ih * 19
Load Picture1(i)
Picture1(i).Top = ih * vsize
Picture1(i).left = il * hsize
Picture1(i).BackColor = RGB(Rnd(1) * 256, Rnd(1) * 256, Rnd(1) * 256)
Picture1(i).Visible = -1
Next i
i = 0
Open "ICONS.DAT" For Input As #1 ' Open file for input.
Indx% = 0
Do While Not EOF(1) And Indx% <= 500 ' Check for end of file.
Input #1, b$(Indx%) ' Read data.
Indx% = Indx% + 1 ' Increment index.
Loop
Close #1 ' Close data file.
ActualIcons = Indx%
Indx% = 0
Open "WAVS.DAT" For Input As #1 ' Open file for input.
Do While Not EOF(1) And Indx% <= 114 ' Check for end of file.
Input #1, a$(Indx%) ' Read data.
Indx% = Indx% + 1 ' Increment index.
Loop
Close #1 ' Close data file.
ActualWavs = Indx%
Rem if we have less than 114, use what we have to
Rem fill the remaining entries.
If ActualWavs < 114 Then
For i = ActualWavs To 113
a$(i) = a$(i Mod ActualWavs)
Next i
End If
End Sub
Sub Picture1_Click (index As Integer)
Rem make each series of icons different (yeah, there are better ways to do this...)
For i = 1 To index
j = Rnd(1)
Next i
j = Int(Rnd(1) * ActualIcons)
s$ = b$(j)
Rem drop the .ICO
s$ = Left$(b$(j), Len(b$(j)) - 4)
Rem drop the path, if there is one
500 For i = 1 To Len(s$)
If Mid$(s$, i, 1) = "\" Then
s$ = Mid$(s$, i + 1)
GoTo 500
End If
Next i
Picture1(index).Picture = LoadPicture(b$(j))
Name2.Text = s$
SoundName$ = a$(index)
wFlag% = SND_ASYNC Or SND_NODEFAULT
Rem drop the .WAV
s$ = Left$(a$(index), Len(a$(index)) - 4)
Rem drop the path, if there is one
50 For i = 1 To Len(s$)
If Mid$(s$, i, 1) = "\" Then
s$ = Mid$(s$, i + 1)
GoTo 50
End If
Next i
Name1.Text = s$
x% = sndPlaySound(SoundName$, wFlag%)
End Sub